package br.com.casablanca.viewbean;

import java.io.Serializable;

import javax.faces.context.FacesContext;
import javax.servlet.http.HttpSession;

import br.com.casablanca.dto.LoginDTO;
import br.com.casablanca.services.LoginService;

public class SkinBean implements Serializable {  
    private static final long serialVersionUID = -2399884208294434812L;
    private String skin="blueSky";
    private String novo;
    
	public String getSkin() {
		return skin;
	}
	public void setSkin(String skin) {
		this.skin = skin;
	}
	public String getNovo() {
		return novo;
	}
	public void setNovo(String novo) {
		setSkin(novo);
		FacesContext context = FacesContext.getCurrentInstance();
		HttpSession session = (HttpSession) context.getExternalContext().getSession(true);
		LoginDTO user = (LoginDTO) session.getAttribute("currentUser");
		new LoginService().atualizaSkin(novo, user);
		this.novo = novo;
	}
}
